home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWPictur.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.3 KB  |  121 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPictur.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPICTUR_H
  11. #define FWPICTUR_H
  12.  
  13. #ifndef FWGRREF_H
  14. #include "FWGrRef.h"
  15. #endif
  16.  
  17. #ifndef SLPICTUR_H
  18. #include "SLPictur.h"
  19. #endif
  20.  
  21. #ifndef FWGC_H
  22. #include "FWGC.h"
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Class Declarations
  27. //========================================================================================
  28.  
  29. class FW_CPictureContext;
  30. class FW_PResourceFile;
  31. class FW_CWritableStream;
  32. class FW_CReadableStream;
  33.  
  34. //========================================================================================
  35. //    class FW_CPicture
  36. //========================================================================================
  37.  
  38. class FW_CPicture : public FW_TGrRefPtr<FW_HPicture>
  39. {
  40. public:
  41.     FW_DECLARE_AUTO(FW_CPicture)
  42.  
  43.     FW_CPicture();
  44.     ~FW_CPicture();
  45.     
  46.     FW_CPicture(FW_PlatformPict platformPict);
  47.     FW_CPicture(FW_PResourceFile& resourceFile, FW_ResourceID resourceID);
  48.     FW_CPicture(FW_CReadableStream& stream);
  49.  
  50.     FW_CPicture(const FW_CPicture& other);
  51.     FW_CPicture& operator=(const FW_CPicture& other);
  52.  
  53.     FW_CPicture Copy() const;
  54.  
  55.     friend FW_CWritableStream& operator << (FW_CWritableStream& stream, const FW_CPicture& picture);
  56.     friend FW_CReadableStream& operator >> (FW_CReadableStream& stream, FW_CPicture& picture);
  57.  
  58.     // ----- Delegation
  59.     
  60.     FW_Boolean            IsEqual(const FW_CPicture& picture) const
  61.                             { return FW_PrivPicture_IsEqual(fRep, picture.fRep); }
  62.  
  63.     void                GetPictBounds(FW_SRect& bounds) const
  64.                             { FW_PrivPicture_GetPictBounds(fRep, bounds); }
  65.  
  66.     void                 GetPictBounds(FW_SGraphicContext& gc, FW_SRect& bounds) const;
  67.     
  68.     FW_PlatformPict        GetPlatformPict() const
  69.                             { return FW_PrivPicture_GetPlatformPict(fRep); }
  70.         
  71.     FW_Boolean            IsPlatformPictOrphan() const
  72.                             { return FW_PrivPicture_IsPlatformPictOrphan(fRep); }
  73.         
  74.     FW_PlatformPict        OrphanPlatformPict() const
  75.                             { return FW_PrivPicture_OrphanPlatformPict(fRep); }
  76.         
  77.     void                SetPlatformPict(FW_PlatformPict newPict);
  78.         
  79.     void                AdoptPlatformPict(FW_PlatformPict newPict);
  80.     
  81. #ifdef FW_BUILD_MAC
  82.     void                MacLock()
  83.                             { FW_FailOnError(FW_PrivPicture_MacLock(fRep)); }
  84.         
  85.     void                MacUnlock()
  86.                             { FW_FailOnError(FW_PrivPicture_MacUnlock(fRep)); }
  87. #endif
  88. };
  89.  
  90. //========================================================================================
  91. //    class FW_CPictureContext
  92. //========================================================================================
  93.  
  94. class FW_CPictureContext : public FW_CGraphicContext
  95. {
  96. public:
  97.     FW_DECLARE_AUTO(FW_CPictureContext)
  98. public:
  99.     FW_CPictureContext(Environment* ev,
  100.                        FW_CPicture& picture,
  101.                        FW_Fixed xSize,
  102.                        FW_Fixed ySize);
  103.                                            // Size is in 72dpi
  104.     virtual ~FW_CPictureContext();
  105.  
  106.     virtual void        Reset();
  107.  
  108. protected:
  109.     ODShape*            PrivAcquireClipShape(Environment* ev);
  110.     
  111. private:
  112.     FW_CPicture&         fPicture;        // A reference because will modify the ref-cnt pointer
  113.     FW_HGDevice            fGraphicDevice;
  114.     
  115. #ifdef FW_BUILD_MAC
  116.     PicHandle             fMacPictHandle;
  117. #endif
  118. };
  119.  
  120. #endif
  121.